<%--
  Created by IntelliJ IDEA.
  User: 25387
  Date: 2020/8/19
  Time: 16:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/style/css/layui.css"  media="all">
    <script >
        var xhr = new XMLHttpRequest;
        function turing_submit() {
            var url = "http://www.tuling123.com/openapi/api?key=5592687e29d74d8e9c57394718b57a33&info=" + document.getElementById("turing_input_box").value;
            xhr.open("get",url,false);
            xhr.send(null);
            if ( (xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 ){
                var a=$("#turing_input_box").val();
               $("#turing_output_box").append("我："+a+"                                                                                                                                                                                       ");
                $("#turing_input_box").val("");
               $("#turing_output_box").append("小机器人对你说："+eval("(" + xhr.responseText + ")").text+"                                                                                                                                                                                                                                                                            ") ;
            }
        }

    </script>
</head>
<body style="background-image:url('${pageContext.request.contextPath}/style/image/bg5.jpg');" >
<div >
   <p style=" margin-top: 50px;margin-left:90px;color: whitesmoke;font-size: 80px;font-family: 'Adobe 楷体 Std R'"  class="layui-anim" data-anim="layui-anim-rotate layui-anim-loop">智能小v</p>

<textarea style="margin-left: 600px;margin-top: 0px;" id="turing_output_box" readonly="readonly" rows="40" cols="100">

</textarea>
<br/>
    <br/>
<input style="margin-left: 600px;width: 610px" id="turing_input_box" type="text" class="layui-form-label" placeholder="我想说..." />

<button id="turing_submit_button" onclick="turing_submit();" style=" padding-left: 40px;margin-left: 20px;" type="button" class="layui-btn layui-btn-normal">发送</button>
</div>
</body>
<script type="text/javascript" src="style/js/jquery.min.js"></script>

</html>
